package br.com.gsc.repository;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * Class that call the right persistence provider to handle the request.
 * @author cristiano
 *
 * @param <T>
 */

public abstract class AbsRepository<T>{
	
	@Autowired
	private RepositoryImpl repositoryImpl;
	
	protected void add(T t) {
		repositoryImpl.add(t);		
	}

	protected void remove(T t) {
		repositoryImpl.remove(t);	
	}
	
	protected void update(T t) {
		repositoryImpl.update(t);		
	}

	protected T read(T t,Object pk) {
		return repositoryImpl.read(t,pk);
	}
	
//	protected T read(Object pk) {
//		return repositoryImpl.read(pk);
//	}

	protected List<T> execQuery(String query, String... params) {
		return repositoryImpl.execQuery(query, params);
	}

}
